package com.布隆过滤器;

import org.redisson.Redisson;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;

public class BloomFilterTest {

//    @Autowired
//    private Redisson redisson;

    public static void main(String[] args) {
        RedissonClient redissonClient = Redisson.create();
        RBloomFilter<Object> bloomFilter;
        bloomFilter = redissonClient.getBloomFilter("wlbtest");
        bloomFilter.tryInit(100,0.03);
        bloomFilter.add("wlb");
        bloomFilter.add("123");
        boolean wlb = bloomFilter.contains("wlb");
        System.out.println("wlb = " + wlb);
        boolean haha = bloomFilter.contains("haha");
        System.out.println("haha = " + haha);
    }
}
